package com.superc.lib.helper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class SQLiteHelper extends SQLiteOpenHelper{

	private String createTableSql="CREATE TABLE IF NOT EXISTS table1 (id INTEGER PRIMARY KEY,country VARCHAR,code integer  )";
	
	public String getCreateTableSql() {
		return createTableSql;
	}

	public void setCreateTableSql(String createTableSql) {
		this.createTableSql = createTableSql;
	}

	public SQLiteHelper(Context context, String name, CursorFactory factory,
			int version) {
		
		super(context, name, factory, version);		
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		System.out.println("create table");
		db.execSQL(createTableSql);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		 db.execSQL("DROP TABLE IF EXISTS table1");  
	        onCreate(db); 
	}
	
}
